package com.zork.cmdb.webapi.mapper.cmdb;

import com.zork.cmdb.webapi.domain.dbo.WarehouseInstanceDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author chenjh
 * @date 2018/6/25
 * @description
 */
@Mapper
public interface WarehouseInsanceMapper {
    @Select("SELECT [InstanceID]\n" +
            "      ,[CICode]\n" +
            "      ,[ModuleID]\n" +
            "      ,[MaintainGroupID]\n" +
            "      ,[InstanceName]\n" +
            "      ,[ModuleInstanceID]\n" +
            "      ,[Label]\n" +
            "      ,[IsDeleted]\n" +
            "      ,[AllAttributes]\n" +
            "      ,[CreateTime]\n" +
            "      ,[CreateUser]\n" +
            "      ,[SourceInstanceID]\n" +
            "      ,[Source]\n" +
            "  FROM [WarehouseInstance]\n" +
            "  WHERE [SourceInstanceID] = #{sourceInstanceID}")
    WarehouseInstanceDO getWarehouseInsanceBySourceInstanceID(@Param("sourceInstanceID") String sourceInsanceID);

    @Select("SELECT [InstanceID]\n" +
            "      ,[CICode]\n" +
            "      ,[ModuleID]\n" +
            "      ,[MaintainGroupID]\n" +
            "      ,[InstanceName]\n" +
            "      ,[ModuleInstanceID]\n" +
            "      ,[Label]\n" +
            "      ,[IsDeleted]\n" +
            "      ,[AllAttributes]\n" +
            "      ,[CreateTime]\n" +
            "      ,[CreateUser]\n" +
            "      ,[SourceInstanceID]\n" +
            "      ,[Source]\n" +
            "  FROM [WarehouseInstance]\n" +
            "  WHERE [CICode] in \n" +
            " (${ciCodeStrsing})")
    List<WarehouseInstanceDO> getWarehouseInstaceByCiCode(@Param("ciCodeStrsing") String ciCodeStrsing);
}
